/**
 *抽屉js 
 **/

/**
 * 添加数据
 **/
function savePonDrawer(data){
	pdb.transaction(function (tx) {
    	tx.executeSql("INSERT INTO DRAWER (ID,NAME,SORT,STATUS,PID) VALUES (?,?,?,?,?)",
    			[data.id==undefined ? '' :data.id,data.text==undefined ? '' :data.text,
    			 data.sort==undefined ? '' :data.sort,data.status==undefined ? '' :data.status,
    			 data.pid==undefined ? '' :data.pid],
       function (tx, rs) {
       },
	   function (tx, error) {
    	   pMessage("添加抽屉数据失败");
	   });
    });
}

/**
 * 初始化抽屉
 **/
function ponDrawer(callback,data){
	pdb.transaction(function (tx) { 
		tx.executeSql('DELETE FROM DRAWER', [], 
		function (tx, results){
			if (typeof(callback) == 'function'){
				$.each(data,function(index,item){
					callback(item);
				});
			}
		}, 
		function (tx, ex){
			pMessage("删除抽屉数据失败");
		});  
	});
}